BUILT_SOURCES = iGeom_protos.h

TESTS = test_edge_orient 

if build_OCC
  TESTS += testgeom_occ mergetest copy_attrib 
else
  TESTS += testgeom
endif

lib_LTLIBRARIES = libiGeom.la

libiGeom_la_LIBADD = 
libiGeom_la_includedir = $(includedir)
LDADD = libiGeom.la $(top_builddir)/src/libcgm.la

if BUILD_CGM
  libiGeom_la_LIBADD += $(top_builddir)/src/libcgm.la 
endif 

AM_CPPFLAGS +=  $(HAVE_OCC_DEF) \
               -DSRCDIR=$(srcdir) \
               -I$(top_builddir)/src \
               -I$(top_srcdir)/src/util/cgm \
               -I$(top_builddir)/src/util/cgm \
               -I$(top_builddir)/src/geom/cgm \
               -I$(top_srcdir)/src/geom/cgm \
               -I$(top_srcdir)/src/geom/parallel/cgm \
               -I$(top_srcdir)/src/init/cgm \
               -I$(top_builddir)/src/init/cgm 

check_PROGRAMS = chaman $(TESTS)
if USE_MPI
  AM_CPPFLAGS += -I$(top_srcdir)/src/geom/parallel/cgm -DUSE_MPI
  libiGeom_la_LIBADD += $(top_builddir)/src/geom/parallel/libcgm_parallel.la

if build_OCC
  TESTS += partest
  partest_SOURCES = partest.cpp
  partest_CPPFLAGS = $(testgeom_occ_CPPFLAGS)
endif

endif

libiGeom_la_SOURCES = \
	CGMAIterator.hpp \
	CATag.hpp \
	CATag.cpp \
	iGeom_CGMA.cc \
	iGeomError.cc \
	iGeomError.h  

libiGeom_la_include_HEADERS = iGeom_protos.h 

nobase_includedir = $(includedir)/cgm
nodist_nobase_include_HEADERS = CGMIGeomConfigure.h

if ITAPS_SHIM
  AM_CPPFLAGS += -DITAPS_SHIM
  libiGeom_la_SOURCES += \
    iGeom_private.h
  libiGeom_la_include_HEADERS += \
    CGM_iGeom.h
else
  libiGeom_la_include_HEADERS += \
	iGeom.h \
	iGeom_f.h
endif

AM_LDFLAGS +=  $(CGM_EXT_LTFLAGS) $(CGM_EXT_LDFLAGS)
testgeom_SOURCES = testgeom.cc
testgeom_occ_SOURCES = $(testgeom_SOURCES)
testgeom_occ_CPPFLAGS = $(CPPFLAGS) $(AM_CPPFLAGS) -DFORCE_OCC

test_edge_orient_SOURCES = test_edge_orient.cc

chaman_SOURCES = chaman.cc

copy_attrib_SOURCES = copy_attrib.cpp

mergetest_SOURCES = mergetest.cc


# Automake doesn't seem to have a directory defined for
# platform-dependent data (or include) files. So put 
# in $(libdir).  Define a $(cfgdir) to get around automake's
# check that only libraries are going in $(libdir)
cfgdir = $(libdir)
cfg_DATA = iGeom-Defs.inc

# By default, iGeom-Defs.inc will define these to $(srcdir).  We
# want to override that during the INSTALL of the file so
# that the correct values are set (e.g. if someone does 
# 'make prefix=/foo install', we don't know the correct install
# directory until we're doing the install.
CFG_FILE = $(DESTDIR)$(cfgdir)/iGeom-Defs.inc
install-data-hook:
	$(AM_V_at)echo "IGEOM_CXX_LDFLAGS = -L${libdir}" >> $(CFG_FILE)
	$(AM_V_at)echo "IGEOM_CXX_LTFLAGS = -R${libdir}" >> $(CFG_FILE)
	$(AM_V_at)echo "IGEOM_INCLUDEDIR = ${includedir}" >> $(CFG_FILE)
	$(AM_V_at)echo 'IGEOM_INCLUDES = -I$$(IGEOM_INCLUDEDIR) -I$$(IGEOM_INCLUDEDIR)/cgm' >> $(CFG_FILE)

EXTRA_DIST =  size.step brick_2.stp ilc_13body.stp ilc_1body.stp ilc_problem_surf8.stp \
          voltest.stp brick.facet CMakeLists.txt 

CLEANFILES = iGeom-Defs.inc  mmgr.log step_import.log test.occ \
        merged.occ

DISTCLEANFILES = CGMIGeomConfigure.h

